package
{
	import flash.display.GradientType;
	import flash.display.SpreadMethod;
	import flash.display.Sprite;
	import flash.geom.Matrix;
	

	public class Background extends Sprite {
        private var radialActive:Boolean;
        private var fillType:String;
        private var colors:Array;
        private var alphas:Array = [0.5, 0.5];
        private var ratios:Array = [0x00, 0xFF];
        private var matr:Matrix = new Matrix();
        private var spreadMethod:String = SpreadMethod.PAD;

        public function Background(){

             
            this.alpha = 0.5;
        }
        
        public function createRadial():void {
            radialActive = true;
            colors = [0xff3333, 0x66ff66];
            fillType = GradientType.RADIAL;
            matr.createGradientBox(200, 400, Math.PI/2, 0, 0);
            this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);
            this.graphics.drawRect(0,0,200,400);
        }
        
        public function createLinear(cwidth:int,cheight:int):void {
            radialActive = false;
            colors = [0x000000,0xc2c2c2];
            fillType = GradientType.LINEAR;
            matr.createGradientBox(cwidth, cheight, Math.PI/2, 0, 0);
            this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);
            this.graphics.drawRect(0,0,cwidth,cheight);
        }
	}
}